﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ArticleManager.aspx.cs" Inherits="admin_ArticleManager" MasterPageFile="~/admin/AdminMasterPage.master" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>
<asp:Content ID="header" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .buy {
            cursor: pointer;
        }
    </style>
</asp:Content>
<asp:Content ID="main" ContentPlaceHolderID="main" runat="server">
    <div class="panel panel-default">
        <div class="panel-body">
            <blockquote>
                <p style="font-family: 'Microsoft YaHei'">文章管理</p>
            </blockquote>
            <table class="table table-hover" style="margin: 0 auto;">
                <thead>
                    <tr>
                        <th>#</th>
                        <th>标题</th>
                        <th>内容</th>
                        <th>类型</th>
                        <th>访问量</th>
                        <th>发布时间</th>
                    </tr>
                </thead>
                <tbody>
                    <asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound">
                        <ItemTemplate>
                            <tr class="listtable">
                                <td><%#Eval("ID") %></td>
                                <td><%#Eval("TopicTitle") %></td>
                                <td class="Textcontent"><asp:Literal ID="textContent" runat="server" Text='<%#Eval("TopicContent") %>'></asp:Literal></td>
                                <td><asp:Literal ID="textclass" runat="server" Text='<%#Eval("TopicClass") %>'></asp:Literal></td>
                                <td><%#Eval("TopicLookNum") %></td>
                                <td><%#Eval("TopicTime") %></td>
                                <td class="buy"><a>删除
                                </a></td>
                            </tr>
                        </ItemTemplate>
                    </asp:Repeater>
                </tbody>
            </table>
            <div style="margin: 10px auto;">
                <webdiyer:AspNetPager ID="AspNetPager1" runat="server" FirstPageText="首页" LastPageText="尾页" NextPageText="下一页" PrevPageText="上一页" ShowCustomInfoSection="Left" ShowInputBox="Never" OnPageChanged="AspNetPager1_PageChanged" UrlPaging="True"></webdiyer:AspNetPager>
            </div>
        </div>
        <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
                    </div>
                    <div class="modal-body">
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        <button type="button" class="btn btn-primary">Save changes</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
<asp:Content ID="JS" ContentPlaceHolderID="footJS" runat="server">
    <script type="text/javascript">
        $(document).ready(function () {
            var CommodityID = 0;
            $(".navbar-collapse").find("li").eq(1).addClass("active").siblings().removeClass("active");
            $(".listtable").find("td:eq(6)").click(function () {
                var num = 0;
                CommodityID = $(this).parent().find("td:eq(0)").text();
                DeleteTopic(CommodityID);
            });
            $(".listtable").find("td:eq(2)").click(function () {
                var tt = $(this).parent().find("td:eq(2)").html();
                //alert($(this).parent().find("td:eq(0)").text()); 
                $(".modal-body").empty().append(tt);
            });
        });
        function DeleteTopic(ID) {
            $.ajax({
                type: "POST",
                url: "AJAX/DeleteTopic.ashx",
                data: { 'ID': ID },
                datatype: "text/json",
                  success: function (msg) {
                  alert("帖子删除成功！");
                  location.reload();
                }
            });
        }
    </script>
</asp:Content>
